<template>
	<view class="content">
		<navTop :title="navtop.title" :isHeight="false" :tipsShow="false" hasBgc="#fff" :color="navtop.color" :isBack="true" ></navTop>
		<view class="content-box" :style="{paddingTop:barHeight+'rpx'}">
			<!-- <view class="content-title">Message</view> -->
		</view>
		<view class="contetn-list">
			<view class="contetn-list__item" v-for="(v, i) in list"  :key="i"  @click="readMessage(v.id)">
				<view class="contetn-list__title">
					{{v.createTime}}
				</view>
				<view class="contetn-list__box">
					<view class="title">
						<view class="r-box" v-if="v.state == 0">
						</view>
						<text>{{v.title}}</text>
					</view>
					<view class="center">
						{{v.content || ''}}
					</view>
					<view class="info">
						Release source
					</view>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
import navTop from '@/components/nav-title.vue';
import iconAdd from '@/static/icon_add.png';

	export default {
		components: {
			navTop
		},
		data() {
			return {
				iconAdd,
				barHeight: 0,
				navtop: {
					title: 'Message',
					color: '#024230'
				},
				list: [
				]
			}
		},
		onLoad() {

		},
		created() {
			this.isBarHeight999().then((statusBarHeight)=>{
				this.barHeight = statusBarHeight + 140
				console.log(this.barHeight)
			})
		},
		mounted() {
			this.$http('get', '/app/me/message').then((res) => {
				if (res.success) {
					// res.data.forEach((v) => {
					// 	v.tips = this.$utils.getTimerOff(v.loginTime)
					// })
					this.list = res.data
				}
			})
		},
		methods: {
			readMessage(id) {
				this.$http('post', '/app/message/read', {
					id
				}, {
						'Content-Type': 'application/x-www-form-urlencoded'
					}).then((res) => {
					if (res.success) {
						this.contentList[0].number = res.data.watting || 0
						this.contentList[1].number = res.data.published || 0
						this.contentList[2].number = res.data.rejected || 0
						this.lines[0].info = res.data.liked || 0
					}
				})
			}
		}
	}
</script>

<style lang="less">
.content {
	background-color: #FBFCFE;
	// padding: 0 30px;
	min-height: 100vh;
}
.content-box {
	font-size: 40rpx;
	font-family: Helvetica-Bold, Helvetica;
	font-weight: bold;
	color: #1F1F1F;
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 34rpx;
	.content-title {
		font-size: 40rpx;
		padding: 28rpx 30rpx;
		background-color: #fff;
		width: 100%;
		box-sizing: border-box;
	}
}
.contetn-list {
	padding: 30rpx;
	.contetn-list__item {
		margin-bottom: 50rpx;
	}
	.contetn-list__title {
		width: 150rpx;
		height: 40rpx;
		line-height: 40rpx;
		background: #DDDDDD;
		border-radius: 20rpx;
		text-align: center;
		font-size: 22rpx;
		font-family: Helvetica;
		color: #FFFFFF;
		margin: auto;
	}
	.contetn-list__box {
		padding: 34rpx 30rpx;
		background-color: #fff;
		margin-top: 30rpx;
		box-shadow: 0px 4px 12px 0px rgba(55, 58, 64, 0.08);
		.title {
			display: flex;
			justify-content: flex-start;
			align-items: center;
			font-size: 32rpx;
			font-family: Helvetica;
			color: #1F1F1F;
			margin-bottom: 18rpx;
		}
		.r-box {
			width: 16rpx;
			height: 16rpx;
			border-radius: 50%;
			background: #EF4042;
			margin-right: 18rpx;
		}
	}
}
.center {
	font-size: 26rpx;
	font-family: Helvetica;
	color: rgba(31, 31, 31, 0.65);
}
.info {
	font-size: 24rpx;
	font-family: Helvetica;
	color: rgba(31, 31, 31, 0.45);
}
</style>
